{extend name="public:base" /}
{block name="main"}
<div class="main">
    <div class="main_inner">
        <div class="main_left single_mianimage">
            <div class="header-mbx-nav">
                <a href="/">首页</a>
                <i class="iconfont"></i>
                <a href="#">正文</a>

            </div>
            <div class="item_title">
                <h1>{$info.title}<span class="post_title_topimg"></span></h1>
            </div>
            <div class="item_images_info cl">
                <span class="image-info-time"><i class="iconfont"></i>{$info.createtime_text}</span>
                <span class="image-info-cat"><i class="iconfont"></i>{$fenlei_title}</span>
                <span class="cx-views" data-nonce="b2b4b003"><i class="iconfont"></i>{$info.link}</span>
            </div>
            <!-- 正文部分 -->
            <div class="content">
                <div class="content_left" id="content">

                    <div class="image_div" id="image_div">
                        {notempty name="info.zhu_images_text"}
                            {if $info.type eq 2}
                                {foreach $info.zhu_images_text as $key=>$vo }
                                <p>
                                    <video src="{$vo}" controls="controls">
                                        您的浏览器不支持 video 标签。
                                    </video>
                                </p>
                                {/foreach}
                            {else /}
                                {foreach $info.zhu_images_text as $key=>$vo }
                                <p><img src="{$vo}" alt="{$info.title}" width="750" height="1247" class="alignnone size-full wp-image-937" /></p>
                                {/foreach}
                            {/if}
                        {else /}
                            <div style="text-align:center">暂无数据</div>
                        {/notempty}

                    </div>
                    {if $type eq 1 }
                    <div style="text-align:center">价格：{$info.price}元</div>
                    <div style="text-align:center;margin-top:10px"><button type="submit" style="background: red;color:#FFFFFF"  class="btn btn-default" id="buy">立即购买</button></div>
                    <div class="image_div image_postall" id="image_div_all"></div>
                    {/if}
                </div>
            </div>
            <div class="postmetadb-data">
            </div>


            <!-- 引用 -->
            <section class="single-post-comment" id="comments">

                <h2>评论</h2>
                <div class="single-post-comment-reply" id="respond">
                    <form action="http://cxudy-one.demo.chenxingweb.com/wp-comments-post.php" onsubmit="return false;" class="comment_form" method="post" id="commentform">
                        <div class="single-post-comment__form cf">
                            <textarea class="textarea form-control" data-widearea="enable" id="comment" name="comment" placeholder="你怎么看？"></textarea>
                            <input type="hidden" name="article_id" value="{$info.id}" id="article_id" />
                            <input type="hidden" name="comment_parent" id="comment_parent" value="0" />
                            <span class="mail-notify-check"><input type="checkbox" name="comment_mail_notify" id="comment_mail_notify" value="comment_mail_notify" checked="checked" style="vertical-align:middle;" /><label for="comment_mail_notify" style="vertical-align:middle;">有人回复时邮件通知我</label></span>
                        </div>

                        <div id="comboxinfo" class="comboxinfo cl">
                            <!--<div class="cominfodiv cominfodiv-author ">
                                <p for="author" class="nicheng"> <input type="text" name="author" id="author" class="texty" value="" tabindex="1" /> <span class="required">昵称*</span> </p>
                            </div>
                            <div class="cominfodiv cominfodiv-email">
                                <p for="email"> <input type="text" name="email" id="email" class="texty" value="" tabindex="2" /> <span class="required">邮箱*</span> </p>
                            </div>
                            <div class="cominfodiv cominfodiv-url">
                                <p for="url"><input type="text" name="url" id="url" class="texty" value="" tabindex="3" /><span>网址 </span> </p>
                            </div>-->
                            {if $Think.cookie.uid}
                            <button type="submit" class="ladda-button comment-submit-btn"><span class="ladda-label">提交评论</span></button>
                            {else /}
                            <a class="rlogin login_hre_btn logint" style="float:left" href="{:url('index/user/login')}">请先登录</a>
                            {/if}
                            <!--<div id="cancel_comment_reply">
                                <a rel="nofollow" id="cancel-comment-reply-link" href="/%e6%80%a7%e6%84%9f%e7%be%8e%e5%a5%b3/935.html#respond" style="display:none;">取消回复</a>
                            </div>-->
                        </div>

                    </form>

                    <!--<script type="text/javascript">
                        document.getElementById("comment").onkeydown = function (moz_ev){
                            var ev = null;
                            if (window.event){
                                ev = window.event;
                            }else{
                                ev = moz_ev;
                            }
                            if (ev != null && ev.ctrlKey && ev.keyCode == 13){
                                document.getElementById("submit").click();}
                        }
                    </script>-->
                    <script>
                        $('#buy').on('click',function(){
                            var article_id = $('#article_id').val();
                            $.ajax({
                                type: "POST",
                                url: "{:url('tag/buy')}",
                                data: {article_id:article_id},
                                dataType: "json",
                                success: function(data){
                                    alert(data.msg);
                                    if(data.code==1)
                                    {
                                        $(location).attr('href',"{:url('user/test')}");
                                    }
                                }
                            });

                        })


                        $("form").submit(function(e){
                            var content = $('#comment').val();
                            var article_id = $('#article_id').val();
                            var user_id = "{$user.id}";

                            $.ajax({
                                type: "POST",
                                url: "{:url('tag/comment')}",
                                data: {content:content,article_id:article_id,user_id:user_id},
                                dataType: "json",
                                success: function(data){
                                    if(data.code==1)
                                    {
                                        var str = '';
                                        str += '<hr>';
                                        str += '<li class="comment even thread-even depth-1" id="comment-18">';
                                        str += '<div class="comment cf comment_details">';
                                        str += '<div class="avatar left">';
                                        str += '<a href="javascript:void(0)">';
                                        str += '<img src="__CDN__/assets/word/avatar.jpg" class="avatar" width="100" height="100">			</a>';
                                        str += '</div>';
                                        str += '<div id="div-comment-18" class="commenttext">';
                                        str += '<div class="comment-wrapper">';
                                        str += '<div class="postmeta">';
                                        str += '<a class="user_info_name" href="javascript:void(0)">{$user.nickname}</a>';
                                        str += '<time class="timeago" datetime="2021-07-28 下午1:54"> • '+data.date+'</time>';

                                        str += '<div class="commemt-main">';
                                        str += '<p>'+content+'</p>';
                                        str += '</div>';
                                        str += '</div>';

                                        str += '</div>';
                                        str += '</div>';
                                        str += '</div>';
                                        str += '</li>';
                                        $('#pinglun').prepend(str);
                                    }
                                    alert('评论成功');
                                }
                            });
                        });
                        comment();
                        function comment() {
                            var article_id = $('#article_id').val();
                            $.ajax({
                                type: "POST",
                                url: "{:url('tag/pinglun')}",
                                data: {article_id:article_id},
                                dataType: "json",
                                success: function(data){
                                    var str = '';
                                    $.each( data.list, function( i, val ) {

                                        str += '<hr>';
                                        str += '<li class="comment even thread-even depth-1" id="comment-18">';
                                        str += '<div class="comment cf comment_details">';
                                        str += '<div class="avatar left">';
                                        str += '<a href="javascript:void(0)">';
                                        str += '<img src="__CDN__/assets/word/avatar.jpg" class="avatar" width="100" height="100">			</a>';
                                        str += '</div>';
                                        str += '<div id="div-comment-18" class="commenttext">';
                                        str += '<div class="comment-wrapper">';
                                        str += '<div class="postmeta">';
                                        str += '<a class="user_info_name" href="javascript:void(0)">'+val.user.nickname+'</a>';
                                        str += '<time class="timeago" datetime="2021-07-28 下午1:54"> • '+val.createtime_text+'</time>';

                                        str += '<div class="commemt-main">';
                                        str += '<p>'+val.content+'</p>';
                                        str += '</div>';
                                        str += '</div>';

                                        str += '</div>';
                                        str += '</div>';
                                        str += '</div>';
                                        str += '</li>';

                                    });
                                    $('#pinglun').html(str);


                                }
                            });
                        }

                    </script>



                </div>
                <!-- 显示正在加载新评论 -->
                <ul id="pinglun">
                    <!--<hr>

                    <li class="comment even thread-even depth-1" id="comment-18">
                        <div class="comment cf comment_details">
                            <div class="avatar left">
                                <a href="javascript:void(0)">
                                    <img src="__CDN__/assets/word/avatar.jpg" class="avatar" width="100" height="100">			</a>
                            </div>
                            <div id="div-comment-18" class="commenttext">
                                <div class="comment-wrapper">
                                    <div class="postmeta">
                                            <a class="user_info_name" href="javascript:void(0)">qqwe</a>
                                            <time class="timeago" datetime="2021-07-28 下午1:54"> • 07-28</time>
                                            <<a rel="nofollow" class="comment-reply-link" href="http://cxudy-one.demo.chenxingweb.com/%e6%b8%85%e7%ba%af%e7%be%8e%e5%a5%b3/1025.html?replytocom=18#respond" onclick="return addComment.moveForm( &quot;comment-18&quot;, &quot;18&quot;, &quot;respond&quot;, &quot;1025&quot; )" aria-label="回复给qqwe">回复</a>		  </div>
                                        <div class="commemt-main">
                                            <p>ewqe</p>
                                        </div>
                                    </div>
                                   <div class="comment-awaiting-moderation">您的评论正在等待审核！</div>
                                </div>
                            </div>
                        </div>
                    </li>-->

                </ul>
                <!-- .comment-list -->
            </section>
            <!-- #comments -->
        </div>
    </div>
</div>

{/block}
